﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _02_委托练习
{
    public partial class Frm_SetSpeed : Form
    {
        public Frm_SetSpeed(int step,int speed)
        {
            InitializeComponent();
            //设置步长
            this.trackBar1.Value = step;
            //设置时间间隔
            this.trackBar2.Value = speed;

            //设置显示文本
            this.label2.Text = step.ToString();
            this.label4.Text = speed.ToString();

        }

        private void Frm_SetSpeed_FormClosed(object sender, FormClosedEventArgs e)
        {
            MainForm.设置delToolStripMenuItemEable.Invoke(true);
        }

        private void trackBar1_Scroll(object sender, EventArgs e)
        {
            //设置速度
            MainForm.delSetStep.Invoke(this.trackBar1.Value);
            //修改显示文本
            this.label2.Text = this.trackBar1.Value.ToString();
        }

        private void trackBar2_Scroll(object sender, EventArgs e)
        {
            //设置时间间隔
            MainForm.delSetSpeed.Invoke(this.trackBar2.Value);
            //修改显示文本
            this.label4.Text = this.trackBar2.Value.ToString();
        }
    }
}
